#ifndef _FGLYPHPAGE_H_
#define _FGLYPHPAGE_H_

namespace Font
{

	class Glyph;
	struct GlyphEntry;
	class GlyphMap;
	class Texture;

	class GlyphPage
	{
	
	public:
	
		GlyphPage(Library* a_Library, GlyphMap* a_Owner);
		~GlyphPage();
	
		void SetDimensions(unsigned int a_Width, unsigned int a_Height);
		void WriteGlyphs(const std::vector<GlyphEntry*>& a_Glyphs);

		bool GetKerning();
		void SetKerning(bool a_State);

		int GetDistanceNewLine();
		void SetDistanceNewLine(int a_Amount);

		Texture* GetTexture();
		unsigned int GetWidth();
		unsigned int GetHeight();

		void WriteNextLine();
		void Compile();

	protected:

		void _WriteGlyph(GlyphEntry* a_Glyph);

		GlyphMap* m_Owner;

		Texture* m_Texture;
		GLuint m_Width, m_Height;
		GLubyte* m_Data;
		bool m_DataOwned;

		bool m_Kerning;
		int m_DistanceNewLine;

		unsigned int m_GlyphHorizontal, m_GlyphVertical;
		
		GLuint m_Pitch;
		GLuint m_CursorX, m_CursorY;
		
		Glyph* m_GlyphPrevious;

		Library* m_Library;
	
	}; // class FontTexture

}; // namespace Font
	
#endif